﻿using System;
using System.Collections.Generic;
using System.Linq;
using GTAuto.DAL.Entities;

namespace GTAuto.DAL.DAL
{
    public class DALBrandTypes : DALBase
    {
        public static DALBrandTypes Singleton = new DALBrandTypes();
        
        public List<GTBrandType> GetAll()
        {
            using (var db = new GTAutoDataClassesDataContext(ConnectionString))
            {
                List<BrandType> brandTypes = db.BrandTypes.ToList();

                var ret = new List<GTBrandType>();

                foreach (var brandType in brandTypes)
                {
                    var item = new GTBrandType();
                    item.UpdateTo(brandType);
                    ret.Add(item);
                }
                return ret;
            }
        }


    }
}
